import {createBrowserRouter} from 'react-router-dom'
import {
    DesktopOutlined,
    FileOutlined,
    PieChartOutlined,
    TeamOutlined,
    UserOutlined,
    FileSyncOutlined
  } from '@ant-design/icons';
import Home from '../views/Home/index'
import Login from '../views/Login/index'
import Error from '../views/404/index'

import { lazy } from 'react'
const User=lazy(()=>import('../views/User/index'))
const Order=lazy(()=>import('../views/Order/index'))
const Car=lazy(()=>import('../views/Car/index'))
const Search=lazy(()=>import('../views/Search/index'))
const Index=lazy(()=>import('../views/Index/index'))
const Qxlb=lazy(()=>import('../views/Qxlb/index'))
const Cdgl=lazy(()=>import('../views/Cdgl/index'))
const Yhgl=lazy(()=>import('../views/Yhgl/index'))
export const routerHome=[
    {
        path:'/home/car',
        element:<Car></Car>,
        title:'卡片列表'
    },
    {
        path:'/home/search',
        element:<Search></Search>,
        title:'查询列表'
    },
    {
        path:'/home/user',
        element:<User></User>,
        title:'表单页',
        icon:<PieChartOutlined />
    },
    {
        path:'/home/order',
        element:<Order></Order>,
        title:'详情页',
        icon:<DesktopOutlined />
    },
    {
        path:'/home/index',
        element:<Index></Index>,
        title:'系统管理',
        icon:<TeamOutlined />,
        children:[
            {
                path:'/home/index/qxlb',
                element:<Qxlb></Qxlb>,
                title:'权限类别',
                icon:<FileOutlined />,
            },
            {
                path:'/home/index/cdgl',
                element:<Cdgl></Cdgl>,
                title:'菜单管理',
                icon:<UserOutlined />,
            },
            {
                path:'/home/index/yhgl',
                element:<Yhgl></Yhgl>,
                title:'用户管理',
                icon:<FileSyncOutlined />,
            },
        ]
    },
]
const router=createBrowserRouter([
    {
        path:'/home',
        element:<Home></Home>,
        children:routerHome
    },
    {
        path:'/login',
        element:<Login></Login>
    },
    {
        path:'*',
        element:<Error></Error>
    },
])
export default router